// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) definits fieldsfirst ansi space safe 
// Source File Name:   RemoteControl.java

package jones.gui;

import java.awt.GridLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.*;
import jones.RemoteControlState;

public class RemoteControl extends JDialog
{

    private RemoteControlState state = null;

    public RemoteControl()
    {
        state = RemoteControlState.NONE;
        setTitle("Robot Remote Control");
        setModal(false);
        init();
        setDefaultCloseOperation(1);
        pack();
    }

    private void init()
    {
        JPanel contentPane = new JPanel(((java.awt.LayoutManager) (new GridLayout(3, 3))));
        contentPane.add(((java.awt.Component) (new JPanel())));
        JButton forwardButton = new JButton("Forward");
        forwardButton.addMouseListener(((java.awt.event.MouseListener) (new MouseAdapter() {

            public void mousePressed(MouseEvent e)
            {
                setState(RemoteControlState.FORWARD);
            }

            public void mouseReleased(MouseEvent e)
            {
                setState(RemoteControlState.NONE);
            }

        }
)));
        contentPane.add(((java.awt.Component) (forwardButton)));
        contentPane.add(((java.awt.Component) (new JPanel())));
        JButton leftButton = new JButton("Left");
        leftButton.addMouseListener(((java.awt.event.MouseListener) (new MouseAdapter() {

            public void mousePressed(MouseEvent e)
            {
                setState(RemoteControlState.LEFT);
            }

            public void mouseReleased(MouseEvent e)
            {
                setState(RemoteControlState.NONE);
            }

        }
)));
        contentPane.add(((java.awt.Component) (leftButton)));
        contentPane.add(((java.awt.Component) (new JPanel())));
        JButton rightButton = new JButton("Right");
        rightButton.addMouseListener(((java.awt.event.MouseListener) (new MouseAdapter() {

            public void mousePressed(MouseEvent e)
            {
                setState(RemoteControlState.RIGHT);
            }

            public void mouseReleased(MouseEvent e)
            {
                setState(RemoteControlState.NONE);
            }

        }
)));
        contentPane.add(((java.awt.Component) (rightButton)));
        contentPane.add(((java.awt.Component) (new JPanel())));
        JButton backwardButton = new JButton("Backward");
        backwardButton.addMouseListener(((java.awt.event.MouseListener) (new MouseAdapter() {

            public void mousePressed(MouseEvent e)
            {
                setState(RemoteControlState.BACKWARD);
            }

            public void mouseReleased(MouseEvent e)
            {
                setState(RemoteControlState.NONE);
            }

        }
)));
        contentPane.add(((java.awt.Component) (backwardButton)));
        contentPane.add(((java.awt.Component) (new JPanel())));
        setContentPane(((java.awt.Container) (contentPane)));
    }

    private synchronized void setState(RemoteControlState state)
    {
        this.state = state;
    }

    public synchronized RemoteControlState getState()
    {
        return state;
    }

}
